package lab02.Test11;

import java.util.Scanner;

/**
 * Created by 星月 on 2017/10/25.
 */
public class Square extends Rectangle {

    Square(double with, double length) {
        super(with,length);
    }
    //行为：新增加求对角线长的方法
    double c;
    public double getDiagonal() {
        c = Math.sqrt(width*width + length * length);
        return c;
    }
    public void printMyWay(){
        System.out.println("该正方形的长width="+width+"宽length="+length);
        System.out.println("该正方形的面积area="+getArea());
        System.out.println("该正方形的周长perimeter="+getLength());
        System.out.println("该正方形的对角线diagonal="+getDiagonal());
    }

}
